//
//  CDHomeViewController.swift
//  chendong微博
//
//  Created by chen dong on 2021/3/16.
//

import UIKit
//定义全局
private let cellId = "cellId"


class CDHomeViewController: CDBaseViewController {

    private lazy var statusList = [String]()
    
    //重写父类方法
    override func loadData() {
        
        //延时函数
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {
            
        };
        
        for i in 0..<15 {
            //将数据插入到数组顶部
            statusList.insert(i.description, at: 0)
        }
        self.isPullUp = false
        self.tableView?.reloadData()
        self.refreshControl?.endRefreshing()
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        setupUI()
        // Do any additional setup after loading the view.
        title = "第"
        //push 的动作是nav做的
        let vc = CDMessageViewController()
        
        navigationController?.pushViewController(vc, animated: true)
        
    }

}

//数据源方法
extension CDHomeViewController {
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return statusList.count
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        //去cell
        let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath)
        //设置cell
        
        cell.textLabel?.text = statusList[indexPath.row]
        //返回cell
        return cell
    }
    
}




